home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
DB_CLIPP
/
0769B.ZIP
/
CL_BASIC.TEM
< prev
next >
Wrap
Text File
|
1987-11-06
|
3KB
|
135 lines
<<title cl_basic database app.: add, edit, delete, seek, skip>>
<<* Clipper only! (c) Gregory J. Scott November 5, 1987 >>
<<* ui programmer template, flat keyed file.>>
***
*** Program: {file}.PRG : Add, Edit, Delete, Seek, Skip
*** Generated {date}
*** Program does not maintain a unique key. Warning!
set exact off
set message to 24
mGOTO=1
mSKIP=0
mCHOICE=0
<<ask-for string
message "Enter key expression initialization value, w/quotes if needed"
=keyinit
>>
mKEY={keyinit}
* initialize dbf
<< for all dbfs >>
select 0
use {dbf name} index {dbf name} && presumes that dbf and index have same name
<< endfor >>
<<* the next label only generates code if there are input memvars on screen>>
{init all memvars}
* initial display
<<* here's your screen>>
{display text}
* initial record display
do DISPREC
do while .t.
@23,05 prompt "Edit" message "Edit this record" && menu 1
@23,10 prompt "Add" message "Add a new record" && menu 2
@23,15 prompt "Next" message "move to Next record" && menu 3
@23,20 prompt "Prev" message "move to Previous record" && menu 4
@23,25 prompt "Top" message "jump to Top record" && menu 5
@23,30 prompt "Bott" message "jump to Bottom record" && menu 6
@23,35 prompt "Skip" message "Skip +/- n records" && menu 7
@23,40 prompt "Key" message "use a Key to seek a record" && menu 9
@23,45 prompt "Del" message "Delete this record" && menu 10
@23,50 prompt "Quit" message "Quit this screen" && menu 11
@23,60 say left(time(),5)
@23,66 say iif(deleted(),"DELETED"," ")
menu to mCHOICE
do case
case mCHOICE = 1
do EDITREC
case mCHOICE = 2
do ADDREC
case mCHOICE = 3
do SKIPREC with 1
case mCHOICE = 4
do SKIPREC with -1
case mCHOICE = 5
goto top
case mCHOICE = 6
goto bottom
case mCHOICE = 7
do SKIPREC
case mCHOICE = 8
do KEYREC
case mCHOICE = 9
do DELREC
case mCHOICE = 10
exit
endcase
do DISPREC
enddo
return
* skip n records -------------------------------------------------------
proc SKIPREC
parameters mSKIP
if pcount()=0
mSKIP=0
@24,0 clear
@24,5 say "number of records to skip: " get mSKIP picture "9999"
read
endif
skip mSKIP
do case
case bof()
goto top
case eof()
goto bottom
endcase
return
proc KEYREC
mGOTO=recno()
@24,0 clear
@24,5 say "Key to seek: " get mKEY
read
seek rtrim(mKEY)
if eof() .and. .not. bof()
GOTO mGOTO
endif
return
* edit record -------------------------------------------------------
proc EDITREC
{get all fields}
read
return
* delete record -------------------------------------------------------
proc DELREC
if .not. deleted()
delete
else
recall
endif
return
* append record -------------------------------------------------------
proc ADDREC
append blank
do DISPREC
do EDITREC
return
* basic record display ------------------------------------------------------
proc DISPREC
{say all variables}
{get all variables}
clear gets
return
* EOF {file}.prg